const host = 'http://www.excel.cn';
// const host = 'http://applyserver.gzcjdx.cn';

let server = {
    host: host,
    apihost: host + '/index.php'
};

let api = {
    'getItems': server.apihost + "/table/getItemsApi",//获取条目[首页]
    'getExcelTpl': server.apihost + "/table/getExcelTplApi",//获取模板[填表页]
    'addItems': server.apihost + "/table/addItemsApi",            //添加数据[填表页]
    'items': server.apihost + "/table/itemsApi",
    'dbToExcel': server.apihost + "/table/dbToExcel"
};

let tpl = {
    inputTpl: function (name, value, desc) {
        return `<div class="layui-form-item">
        <label class="layui-form-label el-form-label" >${value}</label>
        <div    >
            <input type="text" name="${name}" required  lay-verify="required" placeholder="${desc}" autocomplete="on" class="layui-input">
        </div>
    </div>`
    },
    itemTpl: function (index, data) {
        return `  <div class="ex-items">
                    <a href="./application.html?s=${data.pk_application_guid}" class="layui-btn layui-btn-lg layui-bg-green layui-btn-fluid">${data.title}(${data.create_time})</a>
                </div>`
    },
    itemTplV2: function (data) {
        return `<div class="ex-itemsv2" onclick="location.href='./application.html?s=${data.pk_application_guid}'">${data.title}
<p>(${data.create_time})</p>
    </div>
`
    },
    th: function (title) {
        return `<th>${title}</th>`;
    },
    td: function (title) {
        return `<td>${title}</td>`;
    },
    footer: function () {
        return `
    <div class="layui-footer el-footer" >
        <!-- 底部固定区域 -->
       
        <p>©2018 填报系统 by 孙武(贵州财大15软工)</p>
        <p>Tel:18212722133 QQ:1228746736</p>
        <p>备案/许可证编号为 黔ICP备17001679号 </p>
    </div>`;
    }
};

function getOneQuery() {
    let query = location.search;
    let index = query.indexOf('=');
    return query.substr(index + 1);
}

